package com.zzyq.pc.common;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.zzyq.pc.common.plugin.db.PageView;

public class StandardDataFormat {

    /**
     * 返回服务器根路径
     */
    @JsonIgnore
    private String basePath;
    @JsonIgnore
    private Object dictionaryValue;
    @JsonIgnore
    private String picBasePath;

    public String getPicBasePath() {
        return picBasePath;
    }

    public void setPicBasePath(String picBasePath) {
        this.picBasePath = picBasePath;
    }

    public Object getDictionaryValue() {
        return dictionaryValue;
    }

    public void setDictionaryValue(Object dictionaryValue) {
        this.dictionaryValue = dictionaryValue;
    }

    public StandardDataFormat() {
        this.returnCode = 0;
        this.returnData = "";
        this.returnMessage = "";
    }

    public StandardDataFormat(Integer code, String message, Object data) {
        this.returnCode = code;
        this.returnMessage = message;
        this.returnData = data;
    }

    /**
     * 返回前端数据
     */
    private Object returnData;
    /**
     * 返回前端端CODE
     */
    private Integer returnCode;
    /**
     * 返回前端端信息
     */
    private String returnMessage;
    @JsonIgnore
    private String customerId;

    public String getCustomerId() {
        return customerId;
    }

    public void setCustomerId(String customerId) {
        this.customerId = customerId;
    }
    @JsonIgnore
    private String keywordName;

    public String getKeywordName() {
        return keywordName;
    }

    public void setKeywordName(String keywordName) {
        this.keywordName = keywordName;
    }

    /**
     * 当前页码
     */
    private Integer pageIndex;

    /**
     * 每页显示行数
     */
    private Integer pageSize;

    /**
     * 总页数
     */
    private Long totalPages;

    /**
     * 总记录数
     */
    private Long totalRecords;
    @JsonIgnore
    private String releaseTime;
    @JsonIgnore
    private Integer number;

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public String getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(String releaseTime) {
        this.releaseTime = releaseTime;
    }

    public Object getReturnData() {
        return returnData;
    }

    public void setReturnData(Object returnData) {
        this.returnData = returnData;
    }

    public Integer getReturnCode() {
        return returnCode;
    }

    public void setReturnCode(Integer returnCode) {
        this.returnCode = returnCode;
    }

    public String getReturnMessage() {
        return returnMessage;
    }

    public void setReturnMessage(String returnMessage) {
        this.returnMessage = returnMessage;
    }

    public Integer getPageIndex() {
        return pageIndex;
    }

    public void setPageIndex(Integer pageIndex) {
        this.pageIndex = pageIndex;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Long getTotalPages() {
        return totalPages;
    }

    public void setTotalPages(Long totalPages) {
        this.totalPages = totalPages;
    }

    public Long getTotalRecords() {
        return totalRecords;
    }

    public void setTotalRecords(Long totalRecords) {
        this.totalRecords = totalRecords;
    }

    public void setError(int errorCode, String errorMsg) {
        this.returnCode = errorCode;
        this.returnMessage = errorMsg;
    }

    public String getBasePath() {
        return basePath;
    }

    public void setBasePath(String basePath) {
        this.basePath = basePath;
    }

    /**
     * set分页参数
     * 
     * @param pageView
     */
    public void setPageViewParams(PageView pageView) {
        if (pageView == null)
            return;
        this.totalPages = pageView.getPageCount();
        this.totalRecords = pageView.getRowCount();
        this.pageIndex = pageView.getPageNow();
        this.pageSize = pageView.getPageSize();
    }
}
